import request from '@/router/axios'

// 营销列表
export function fetchMarketingList(obj) {  // 查询营销列表
    return request({
      url: '/api/campaign/campaignQuery',
      method: 'post',
      data:obj
    })
}

export function fetchmarketbatchList(obj) {  // 查询营销批次报告
  return request({
    url: '/api/campaign/campaignEffect/campaignInstList',
    method: 'post',
    data:obj
  })
}


export function fetchmarketactvityCategory(query) {  // 查询营销活动类别
  return request({
    url: '/api/campaign/campaignCategory/campaignCategoryAll',
    method: 'get',
    data:query
  })
}

export function fetchmarketactivitygrouplist(obj) {  // 查询营销人群
  return request({
    url: '/api/campaign/campaignSet/targetQuery',
    method: 'post',
    data:obj
  })
}

export function fetchmarketgroupcategoryList(obj) {  // 查询营销人群分类
  return request({
    url: '/api/customer/targetCategory/page',
    method: 'post',
    data:obj
  })
}

export function fetchmarketcouponList(obj) {  // 查询营销优惠券
  return request({
    url: '/api/cuppon/coupon/page',
    method: 'post',
    data:obj
  })
}

export function fetchmarketactvityList(query) {  // 查询营销效果报告
  return request({
    url: '/api/campaign/campaignCategory/campaignCategoryAll',
    method: 'get',
    data:query
  })
}
// 营销列表
//-----------------营销效果报告相关接口--开始--------------------
export function fetchMarketingreport(obj) {  // 查询营销效果报告
  return request({
    url: '/api/campaign/campaignEffect/report',
    method: 'post',
    data:obj
  })
}

export function fetchmarketReportProductQuery(query) {  // 查询营销商品效果报告
  return request({
    url: '/api/campaign/campaignEffect/reportProductQuery',
    method: 'post',
    data:query
  })
}

export function fetchmarkettargetSendNum(obj) {  // 查询营销商品效果报告
  return request({
    url: '/api/campaign/campaignSet/targetSendNum',
    method: 'post',
    data:obj
  })
}

export function fetchmarketsmsmodellist(obj) {  // 查询营销短信模板列表
  return request({
    url: '/api/sms/communicationTemplate/page/sms',
    method: 'post',
    data:obj
  })
}

// /communicationField/page/all
export function fetchdynamicfield(obj) {  // 查询营销短信模板动态字段列表
  return request({
    url: '/api/sms/communicationField/page/all',
    method: 'get',
    data:obj
  })
}

export function fetchmarketCampaignInstList(obj) {  // 营销活动所有批次
  return request({
    url: '/api/campaign/campaignEffect/campaignInstList/'+obj.campaignId,
    method: 'get',
    data:obj
  })
}
//-----------------营销效果报告相关接口--结束--------------------
export function fetchmarketSMSlist(obj) {  // 新建营销活动短信查询列表
  return request({
    url: '/api/sms/communicationTemplate/page',
    method: 'post',
    data:obj
  })
}

export function fetchmarketwxlist(obj) {  // 新建营销活动微信查询列表
  return request({
    url: '/api/sms/communicationTemplate/page',
    method: 'post',
    data:obj
  })
}
//-------------------- 营销活动分类相关接口-开始-----------------
export function fetchmarketCampaignCategoryAll(obj) {  // 营销活动分类列表
  return request({
    url: '/api/campaign/campaignCategory/campaignCategoryAll',
    method: 'get',
    data:obj
  })
}

export function fetchmarketAddCampaignCategory(obj) {  // 创建营销活动分类
  return request({
    url: '/api/campaign/campaignCategory',
    method: 'post',
    data:obj
  })
}

export function fetchmarketDelCampaignCategory(obj) {  // 删除营销活动分类
  return request({
    url: '/api/campaign/campaignCategory/'+obj.campaignCategoryId,
    method: 'delete',
    data:obj
  })
}
export function fetchmarketEditCampaignCategory(obj) {  // 修改营销活动分类
  return request({
    url: '/api/campaign/campaignCategory/',
    method: 'put',
    data:obj
  })
}
export function fetchmarketEditCampaignCategoryId(obj) {  //营销活动移动到别的分类
  return request({
    url: '/api/campaign/editCampaignCategoryId/',
    method: 'put',
    data:obj
  })
}
//-------------------- 营销活动分类相关接口-结束-----------------
export function fetchmarketEditCampaignStatus(obj) {  //营销活动启动/停止
  return request({
    url: '/api/campaign/editStatus',
    method: 'put',
    data:obj
  })
}
export function fetchmarketDelCampaign(obj) {  //营销活动删除
  return request({
    url: '/api/campaign/'+obj.id,
    method: 'delete',
    data:obj
  })
}

/** --------------------新建营销活动相关保存请求-------------------*/

export function savemarketbasicinfo(obj) {  //保存营销活动基本信息
  return request({
    url: '/api/campaign/campaignSet/saveBaseInfo',
    method: 'post',
    data:obj
  })
}


export function savemarketgrouplist(obj) {  //保存营销活动人群
  return request({
    url: '/api/campaign/campaignSet/saveTarget',
    method: 'post',
    data:obj
  })
}

export function savemarketReward(obj) {  //保存营销活动选择权益
  return request({
    url: '/api/campaign/campaignSet/saveReward',
    method: 'post',
    data:obj
  })
}

export function saveCommunication(obj) {  //保存营销活动沟通方式
  return request({
    url: '/api/campaign/campaignSet/saveCommunication',
    method: 'post',
    data:obj
  })
}

export function saveSchedule(obj) {  //保存营销活动时间
  return request({
    url: '/api/campaign/campaignSet/saveCampaignSchedule',
    method: 'post',
    data:obj
  })
}


export function fetchMarketingRunAgain(obj) {  //营销活动重新执行
  return request({
    url: '/api/campaign/runAgain/',
    method: 'post',
    data:obj
  })
}

export function sendsmstest(obj) {  //营销活动短信测试
  return request({
    url: '/api/sms/communicationTemplate/send',
    method: 'post',
    data:obj
  })
}